<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // 定义是数组
        var array = [3,4,1,2,6,5];
        // 思路用冒泡吧
        for (var i = 1; i < array.length ; i++) {
            for(var j = 0; j < array.length - i ; j++) {
                // 如果前一项大于后一项，则交换位置
                if (array[j] > array[j+1]) {
                    var temp = array[j];
                    array[j] = array[j+1];
                    array[j+1] = temp;
                }
            }
        }
        console.log(array);
    </script>
</head>
<body>
    17.  数组排序；

    ```js

    [3,4,1,2,6,5] ---> [1,2,3,4,5,6]

    ```
</body>
</html>